<template>
  <div id="app">
    <el-form :model="laboratoryHealth" label-width="100px">
      <el-form-item label="实验室名">
        <el-select v-model="laboratoryHealth.lid" placeholder="请选择">
          <el-option
            v-for="item in laboratoryList"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>

      <el-form-item label="检查时间">
        <el-date-picker
          v-model="laboratoryHealth.checkDate"
          type="date"
          placeholder="选择开始时间">
        </el-date-picker>
      </el-form-item>

      <el-form-item label="分数" prop="gender">
        <el-input v-model="laboratoryHealth.score"></el-input>
      </el-form-item>
      <el-form-item label="检查人" prop="description">
        <el-input v-model="laboratoryHealth.checker"></el-input>
      </el-form-item>

      <el-form-item label="描述">
        <el-input v-model="laboratoryHealth.description"  type="textarea" rows="5"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click.prevent="test">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  export default {
    data(){
      return {
        laboratoryList:[],
        laboratoryHealth:{
          name:""
        }
      }
    },
    created() {
      this.axios.get("/laboratory/selectAll").then((resp)=>{
        this.laboratoryList=resp.data;
      });
    },
    methods:{
      test(){

            //发出保存请求
            this.$confirm("是否确认提交","保存提示").then(()=>{
              this.axios.post("/laboratoryHealth/add",this.laboratoryHealth).then((resp)=>{
                this.$message.success("保存成功！");
                this.$router.push("/laboratoryHealth/LaboratoryHealthList")
              });
            }).catch(()=>{});


      }
    }
  }
</script>


<style scoped>

</style>
